layui.use(['laydate', 'laypage', 'layer', 'table', 'carousel', 'upload', 'element', 'slider'], function() {
    var laydate = layui.laydate //日期
        , laypage = layui.laypage //分页
        , layer = layui.layer //弹层
        , table = layui.table //表格
        , carousel = layui.carousel //轮播
        , upload = layui.upload //上传
        , element = layui.element //元素操作
        , slider = layui.slider //滑块
        , $ = layui.jquery;

    //向世界问个好
    layer.msg('Hello World');

    //监听Tab切换
    element.on('tab(demo)', function (data) {
        layer.tips('切换了 ' + data.index + '：' + this.innerHTML, this, {
            tips: 1
        });
    });

    element.on('nav(test)', function(elem){
        console.log(elem); //得到当前点击的DOM对象
    });

    element.tabAdd('demo', {
        title: '选项卡的标题'
        ,content: '选项卡的内容' //支持传入html
        ,id: '选项卡标题的lay-id属性值'
    });
});

